<template>
<div>
    <h4>keep-alive</h4>
    <button @click="changeStatus">切换</button>
    <!-- 缓存组件 -->
    <keep-alive include="reg,log" exclude="reg" max="3">
        <Reg v-if="login"/>
        <Log v-else/>
    </keep-alive>
</div>
</template>
    
<script setup lang='ts'>
import Reg from '../components/login/reg.vue';
import Log from '../components/login/log.vue';
import { ref } from 'vue';

let login = ref<boolean>(true);

let changeStatus = function() {
    login.value = !login.value;
};

</script>
<style>
    
</style>